﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using Website.Logger;
using DAL;
using BOL;

using WebLib;
using System.Web.Script.Services;
using System.Web.Services;
using AjaxControlToolkit;
using UtilityExtensions;

namespace UILGestion.Admin
{
    public partial class InsumoInsertOPTForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                 if (!Page.IsPostBack)
                            {
                                try
                {
                    //internalid.Value = (string)Request.QueryString["id"];
                    //type.Value = (string)Request.QueryString["type"];
                    idTipoInsumo.Value = (string)Request.QueryString["idTipoInsumo"];
                    FormatForm();
                }
                catch (SqlException sqlex)
                {
                    WebServerSideSqlError.Log(sqlex);

                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                     "uniqueKey" + DateTime.Now, "alert('" + sqlex.Message.Replace("'", "") + "');", true);
                 

                }
                catch (Exception ex)
                {
                    WebServerSideError.Log(ex);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                         "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);
                 
                }

            }
            
        }
        private void FormatForm()
    {
            ListItem itemClase= new ListItem();
            itemClase.Value = String.Format("./insumoInsertForm.aspx?type=A&grupo=C&idTipoInsumo={0}", idTipoInsumo.Value);
            itemClase.Text="Crear Clase";
            BulletedList1.Items.Add(itemClase);

            ListItem itemfamilia= new ListItem();
            itemfamilia.Value = String.Format("./insumoInsertForm.aspx?type=A&grupo=F&idTipoInsumo={0}", idTipoInsumo.Value);
            itemfamilia.Text = "Crear Familia";
            BulletedList1.Items.Add(itemfamilia);

            ListItem itemSubFamilia= new ListItem();
            itemSubFamilia.Value = String.Format("./insumoInsertForm.aspx?type=A&grupo=S&idTipoInsumo={0}", idTipoInsumo.Value);
            itemSubFamilia.Text = "Crear SubFamilia";
            BulletedList1.Items.Add(itemSubFamilia);

    }
    }
}